import java.util.Scanner;

public class Solution {
    // 字符串中第一个唯一字符
    public int firstUniqChar(String s) {
        int[] hash = new int[32];
        char[] chs = s.toCharArray();
        for(int i = 0; i < chs.length; i++) {
            int index = chs[i] - 'a';
            hash[index]++;
        }
        for(int i = 0; i < chs.length; i++) {
            int index = chs[i] - 'a';
            if(hash[index] == 1) {
                return i;
            }
        }
        return -1;
    }
    // 字符串最后一个单词的长度
    public static void main1(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        String[] strings = s.split(" ");
        System.out.println(strings[strings.length - 1].length());
    }
    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.nextLine();
        int i = s.length() - 1;
        for(; i >= 0; i--) {
            if(s.charAt(i) == ' ') {
                break;
            }
        }
        //  System.out.println(s.length() + " " + i);
        if(i >= 0) {
            System.out.println(s.length() - 1 - i);
        } else {
            System.out.println(s.length());
        }

    }
}
